<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:90:"/www/wwwroot/api.bjxlxd.com/public/../application/business/view/goods/add_goods_specs.html";i:1598837423;}*/ ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title></title>

    <!-- ================= Favicon ================== -->
    <!-- Standard -->
    <link rel="shortcut icon" href="http://placehold.it/64.png/000/fff">
    <!-- Retina iPad Touch Icon-->
    <link rel="apple-touch-icon" sizes="144x144" href="http://placehold.it/144.png/000/fff">
    <!-- Retina iPhone Touch Icon-->
    <link rel="apple-touch-icon" sizes="114x114" href="http://placehold.it/114.png/000/fff">
    <!-- Standard iPad Touch Icon-->
    <link rel="apple-touch-icon" sizes="72x72" href="http://placehold.it/72.png/000/fff">
    <!-- Standard iPhone Touch Icon-->
    <link rel="apple-touch-icon" sizes="57x57" href="http://placehold.it/57.png/000/fff">

    <!-- Styles -->
    <link href="/static/admin/other/fontAwesome/css/fontawesome-all.min.css" rel="stylesheet">
    <link href="/static/admin/css/lib/themify-icons.css" rel="stylesheet">
    <link href="/static/admin/css/lib/mmc-chat.css" rel="stylesheet" />
    <link href="/static/admin/css/lib/sidebar.css" rel="stylesheet">
    <link href="/static/admin/css/lib/bootstrap.min.css" rel="stylesheet">
    <link href="/static/admin/css/lib/nixon.css" rel="stylesheet">
    <link href="/static/admin/css/style.css" rel="stylesheet">
</head>

<body>

<!-- /# sidebar -->

<div class="content-wrap">
    <div class="main">
        <div class="container-fluid">
            <div class="main-content">
                <form action="" method="post" id="topform">
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="card alert">

                                <div class="card-body">
                                    <div class="basic-form">
                                        <div class="form-group">
                                            <label>规格名称</label>
                                            <input type="text" name="specs_name" id="specs_name" class="form-control" value="" placeholder="规格名称">
                                        </div>
                                        <div class="form-group" id="danpin">
                                            <label>非团购价格</label>
                                            <input type="text" name="price" id="price" class="form-control" value="" placeholder="非团购价格">
                                        </div>
                                        <div class="form-group">
                                            <label>库存</label>
                                            <input type="text" name="stock" id="stock" class="form-control" value="" placeholder="库存">
                                        </div>
                                        <div class="form-group" id="tuangou">
                                            <label>团价数量及价格</label>
                                            <input type="text" name="t_price_number" id="t_price_number" class="form-control" value="" placeholder="填写格式 (10-20数量,99价格@21-50数量,88价格) 数量10-20,价格99, @分隔 ">
                                        </div>
                                        <button type="button" id="add_goods_specs" class="btn btn-success m-b-10 m-l-5">添加</button>
                                        <button type="button" id="close" class="btn btn-success m-b-10 m-l-5">关闭</button>
                                    </div>
                                </div>
                            </div>
                        </div><!-- /# column -->
                    </div><!-- /# row -->
                </form>
            </div><!-- /# container-fluid -->
        </div><!-- /# main -->
    </div><!-- /# content wrap -->
</div>

<script src="/static/admin/js/lib/jquery.min.js"></script><!-- jquery vendor -->
<script src="/static/admin/js/lib/jquery.nanoscroller.min.js"></script><!-- nano scroller -->
<script src="/static/admin/js/lib/sidebar.js"></script><!-- sidebar -->
<script src="/static/admin/js/lib/bootstrap.min.js"></script><!-- bootstrap -->
<script src="/static/admin/js/lib/mmc-common.js"></script>
<script src="/static/admin/js/lib/mmc-chat.js"></script>
<script src="/static/admin/layer/layer.js"></script><!-- scripit init-->
<script src="/static/admin/layer/common.js"></script>


<script>

    // 获取父页面选项
    var is_group_buy = $("#is_group_buy",parent.document).val();

    if (is_group_buy == 1){
        $('#tuangou').hide()
    }else if (is_group_buy == 2){
        $('#danpin').hide()
    }

    $('#add_goods_specs').click(function (){
        var specs_name = $('#specs_name').val();
        var price = $('#price').val();
        var stock = $('#stock').val();
        var t_price_number = $('#t_price_number').val();

        if(!specs_name){ error('规格有误'); return; }

        if (is_group_buy == 1 || is_group_buy == 3){
            if(!price){ error('非团购价格有误'); return; }
        }
        if(!stock){ error('库存有误'); return; }

        if (is_group_buy == 2 || is_group_buy == 3){
            if(!t_price_number){ error('团价数量及价格有误'); return; }
        }

        parent.add_specs(specs_name, price, stock, t_price_number)
    })

    $('#close').click(function (){
        window.parent.layer.closeAll()
    })
</script>

</body>
</html>